<template>
    <div class="son">
        <h2>我是Son组件（孙组件）</h2>
        <ul>
            <li>汽车名称：{{name}}</li>
            <li>汽车价格：{{price}}</li>
        </ul>
    </div>
</template>

<script>
    import { inject, toRefs } from 'vue';
    export default {
        name: 'Son',
        setup() {
            let car = inject('car');
            console.log('car:', car);

            return {
                ...toRefs(car),
            }
        }
    }
</script>
<style lang="css">
    .son {
        background-color: yellow;
        padding: 10px;
    }
</style>